home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DMAKE38B.ARJ / DEBUG.H < prev    next >
C/C++ Source or Header  |  1992-01-23  |  3KB  |  112 lines

  1. /*
  2.  * (c) Copyright 1990 Conor P. Cahill (uunet!virtech!cpcahil).  
  3.  * You may copy, distribute, and use this software as long as this
  4.  * copyright statement is not removed.
  5.  */
  6. /************************************************************************/
  7. /*                                    */
  8. /* this include sets up some macro functions which can be used while    */
  9. /* debugging the program, and then left in the code, but turned of by    */
  10. /* just not defining "DEBUG".  This way your production version of     */
  11. /* the program will not be filled with bunches of debugging junk    */
  12. /*                                    */
  13. /************************************************************************/
  14. /*
  15.  * $Id: debug.h,v 1.1 1992/01/24 03:28:59 dvadura Exp $
  16.  */
  17.  
  18. #ifdef DEBUG
  19.  
  20. #if DEBUG == 1            /* if default level            */
  21. #undef DEBUG
  22. #define DEBUG    100        /*   use level 100            */
  23. #endif
  24.  
  25. #include <stdio.h>
  26.  
  27. #define DEBUG0(val,str)\
  28.                 {\
  29.                   if( DEBUG > val ) \
  30.                     fprintf(stderr,"%s(%d): %s\n",\
  31.                         __FILE__,__LINE__,str);\
  32.                 }
  33. #define DEBUG1(val,str,a1)\
  34.                     {\
  35.                   char _debugbuf[100];\
  36.                   if( DEBUG > val )\
  37.                    {\
  38.                     sprintf(_debugbuf,str,a1);\
  39.                     fprintf(stderr,"%s(%d): %s\n",\
  40.                         __FILE__,__LINE__,_debugbuf);\
  41.                    }\
  42.                        }
  43.  
  44. #define DEBUG2(val,str,a1,a2)\
  45.                     {\
  46.                  char _debugbuf[100];\
  47.                   if( DEBUG > val )\
  48.                    {\
  49.                     sprintf(_debugbuf,str,a1,a2);\
  50.                     fprintf(stderr,"%s(%d): %s\n",\
  51.                         __FILE__,__LINE__,_debugbuf);\
  52.                    }\
  53.                        }
  54.  
  55. #define DEBUG3(val,str,a1,a2,a3)\
  56.                     {\
  57.                   char _debugbuf[100];\
  58.                   if( DEBUG > val )\
  59.                    {\
  60.                     sprintf(_debugbuf,str,a1,a2,a3);\
  61.                     fprintf(stderr,"%s(%d): %s\n",\
  62.                         __FILE__,__LINE__,_debugbuf);\
  63.                    }\
  64.                        }
  65.  
  66. #define DEBUG4(val,str,a1,a2,a3,a4)\
  67.                      {\
  68.                   char _debugbuf[100];\
  69.                   if( DEBUG > val )\
  70.                    {\
  71.                     sprintf(_debugbuf,str,a1,a2,a3,a4);\
  72.                     fprintf(stderr,"%s(%d): %s\n",\
  73.                         __FILE__,__LINE__,_debugbuf);\
  74.                    }\
  75.                        }
  76.  
  77. #define DEBUG5(val,str,a1,a2,a3,a4,a5)\
  78.                      {\
  79.                   char _debugbuf[100];\
  80.                   if( DEBUG > val )\
  81.                    {\
  82.                     sprintf(_debugbuf,str,a1,a2,a3,a4,a5);\
  83.                     fprintf(stderr,"%s(%d): %s\n",\
  84.                         __FILE__,__LINE__,_debugbuf);\
  85.                    }\
  86.                        }
  87.  
  88. #else
  89.  
  90. #define DEBUG0(val,s)
  91. #define DEBUG1(val,s,a1)
  92. #define DEBUG2(val,s,a1,a2)
  93. #define DEBUG3(val,s,a1,a2,a3)
  94. #define DEBUG4(val,s,a1,a2,a3,a4)
  95. #define DEBUG5(val,s,a1,a2,a3,a4,a5)
  96.  
  97. #endif /* DEBUG */
  98.  
  99.  
  100. /*
  101.  * $Log: debug.h,v $
  102.  * Revision 1.1  1992/01/24  03:28:59  dvadura
  103.  * dmake Version 3.8, Initial revision
  104.  *
  105.  * Revision 1.2  90/05/11  00:13:08  cpcahil
  106.  * added copyright statment
  107.  * 
  108.  * Revision 1.1  90/02/23  07:09:01  cpcahil
  109.  * Initial revision
  110.  * 
  111.  */
  112.